<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
	<title>小鱼ADMIN</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
	<link rel="stylesheet" href="/public/static/css/font.css">
	<link rel="stylesheet" href="/public/static/css/bgadmin.css">
	<script type="text/javascript" src="/public/static/js/jquery-1.8.0.min.js"></script>
	<script type="text/javascript" src="/public/static/lib/layui/layui.js" charset="utf-8"></script>
	<script type="text/javascript" src="/public/static/js/bgadmin.js"></script>
	<script type="text/javascript" src="/public/static/js/jquery.form.js"></script>  
</head>
<style>
    .layui-form-label{ width: 110px; }
    
</style>
<body>
    <div class="bg-body" id="id_playaudio" style="text-align: center;">
		<audio src="http://172.88.88.77/index.php?m=CDR&a=downloadCDR&uniqueid={$uniqueid}" controls="controls">
			Your browser does not support the audio element.
		</audio>
	</div>

    <div class="bg-body">
        <div class="layui-row">
          <form class="layui-form" id="mainForm">
            <input type="hidden" name="uniqueid" value="{$uniqueid}">
            <input type="hidden" name="dept_id" value="{$cdrData.dept_id}">
            <input type="hidden" name="workno" value="{$cdrData.workno}">
            <div class="layui-form-item" style="margin-bottom:0px;">
              <div class="layui-inline">
                <label class="layui-form-label">是否成单客户：</label>
                <div class="layui-input-inline">
                  <select name="order_form" id="order_form" lay-verify="" lay-filter="order_form" autocomplete="off" class="layui-input" lay-search="">
                      <option value="Y" selected>是</option>  <!--请选择-->
                      <option value="N">否</option>  <!--请选择-->
                  </select>
                </div>
              </div>

              
              <div class="layui-inline fail" style="display: none;">
                <label class="layui-form-label">未成单原因：</label>
                <div class="layui-input-inline">
                  <select name="reason" id="reason" lay-verify="" autocomplete="off" class="layui-input" lay-search="">
                      <option value="">请选择</option>  <!--请选择-->
                      <option value="1">客户不要</option>  <!--请选择-->
                      <option value="2">沟通障碍</option>  <!--请选择-->
                      <option value="3">话术问题</option>  <!--请选择-->
                      <option value="4">核单未通过</option>  <!--请选择-->
                  </select>
                </div>
              </div>
              <div class="layui-form-item layui-form-text fail" style="display: none;">
                  <label class="layui-form-label">
                      备注：
                  </label>
                  <div class="layui-input-inline">
                      <textarea class="layui-textarea" name="remarks" id="remarks" cols="50" rows="3" style="resize:none;"></textarea>
                  </div>
              </div>


              <div class="layui-inline success">
                <label class="layui-form-label">评分：</label>
                <div class="layui-input-inline">
                  <input type="text" name="score" lay-verify="" id="score" autocomplete="off" class="layui-input">
                </div>
              </div>

              <div class="layui-form-item layui-form-text success">
                  <label class="layui-form-label">
                      评价：
                  </label>
                  <div class="layui-input-inline">
                      <textarea class="layui-textarea" name="evaluate" id="evaluate" cols="50" rows="3" style="resize:none;"></textarea>
                  </div>
              </div>

                <div class="layui-inline">
                    <label class="layui-form-label"></label>
                    <div class="layui-input-inline">
                        <a class="layui-btn" lay-submit=""  id="save" lay-filter="save">保存</a>
                    </div>
                </div>
          </form>
        </div>
    </div>
</body>

<script>
    var layer = layui.layer;
    var layedit = layui.layedit;
    var ajax_option={  
        url:"recordEvaluation",
        success:function(data){
            var result = $.parseJSON(data); 
            // alert(result)
            if (result.success) {  
                layer.alert(result.msg, {icon: 6}, function(index){
                    bg_admin_close();
                    parent.location.replace("/index.php/crm/Cdr/listCDR");
                });
            } else {  
                layer.alert(result.msg, {icon: 5}, function(index){
                    layer.close(index);
                });
            }
        }
    };

    layui.use(['form','table'], function(){
        var form = layui.form;
        var table = layui.table;
        form.on('select(order_form)', function(data){
            var order_form = $('#order_form').val();
            if (order_form == 'Y') {
                $('.fail').css('display','none');
                $('.success').css('display','inline-block');
                
            } else {
                $('.fail').css('display','inline-block');
                $('.success').css('display','none');
            }

            alert(order_form)

            return false;
        }); 
        
    });


    layui.use(['form', 'layedit'], function(){
        var form = layui.form
        ,layedit = layui.layedit;
        
        form.on('submit(save)', function(data){
            $('#mainForm').ajaxSubmit(ajax_option);
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        }); 
    });

</script>

</html>